Skip to content

Design improvement for student, ta, and instructor tables#7557

Merged
david-yz-liu merged 7 commits intoMarkUsProject:masterfrom
ch-iv:improve-table-no-data-ui
Jun 9, 2025
Merged

Design improvement for student, ta, and instructor tables#7557
david-yz-liu merged 7 commits intoMarkUsProject:masterfrom
ch-iv:improve-table-no-data-ui

Conversation

@ch-iv
Copy link
Copy Markdown
Contributor

@ch-iv ch-iv commented Jun 5, 2025

Fixes: #5920

TLDR:

Design improvement for student, ta, and instructor tables when the table is empty

Proposed Changes

Crate a custom component that is shown when the table does not have any rows to display. The message is no longer overplayed over the table header and is shown below it instead. Different custom messages are implement for different tables.

Screenshots

Widescreen:
image
Narrow:
image
With scroll bar enabled:
image

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots) x
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

@ch-iv ch-iv requested a review from Copilot June 5, 2025 04:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refines the visual design of the student, TA, and instructor tables when no rows are present by introducing a custom "no data" component and updating locale strings.

  • Added locale entries for empty table messages
  • Introduced a new React component for displaying "no data" messages
  • Updated tables and tests to use the new component and locale keys

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
config/locales/views/users/en.yml Added locale messages for empty tables
app/javascript/Components/table_no_data.jsx Created a new component to render empty table messages
app/javascript/Components/ta_table.jsx Updated table to use the new "no data" component
app/javascript/Components/student_table.jsx Updated table to use the new "no data" component
app/javascript/Components/instructor_table.jsx Updated table to use the new "no data" component
app/javascript/Components/tests/*.jsx Updated tests to reflect new empty message texts
app/assets/stylesheets/common/core.scss Added styling for the new "no data" component
Changelog.md Documented the design improvements
Comments suppressed due to low confidence (1)

app/javascript/Components/table_no_data.jsx:3

  • [nitpick] Consider renaming 'tableNoDataComponent' to 'TableNoData' to follow React component naming conventions, which recommend using PascalCase for component names.
export const tableNoDataComponent = empty_table_message => {

@coveralls
Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 15466657172

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 91.953%

Totals Coverage Status
Change from base Build 15431638733: 0.001%
Covered Lines: 41944
Relevant Lines: 44930

💛 - Coveralls

@ch-iv
Copy link
Copy Markdown
Contributor Author

ch-iv commented Jun 5, 2025

I think this is the default choice here and I am happy with the design. Please let me know if you have anything else in mind.

@ch-iv ch-iv requested a review from david-yz-liu June 5, 2025 21:12
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ch-iv the styling is good. In terms of functionality, I would actually like you to change the behaviour for all uses of react table, not just these three tables.

To override the component in general, you can modify the react table defaults (see react_config.js). See also https://github.com/TanStack/table/tree/v6?tab=readme-ov-file#component-overrides.*

Note that the actual text of the component can be passed in with the noDataText prop. See also https://github.com/TanStack/table/blob/v6/src/index.js#L851.

To be clear, I'm not expecting you to write custom messages for every single table. You can leave the ones you've already written and just keep "No rows found" for the others.

*We're using an older version of react-table, v6. This is likely why you had a hard time finding documentation for the library; sorry, I should have warned you about that!

@ch-iv
Copy link
Copy Markdown
Contributor Author

ch-iv commented Jun 9, 2025

I made the custom no data component show for every react table. I also added some tests just for the new default options.

@ch-iv ch-iv requested a review from david-yz-liu June 9, 2025 03:29
@david-yz-liu david-yz-liu merged commit 06d0040 into MarkUsProject:master Jun 9, 2025
6 checks passed
@david-yz-liu
Copy link
Copy Markdown
Collaborator

@ch-iv this is good; please update the PR title and description so that it doesn't just focus on the student/TA/instructor tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'No rows found' blocking views of headers

4 participants